#ifndef CBUTTON_H_INCLUDED
#define CBUTTON_H_INCLUDED

/**
 *
 * \file CButton.h
 * \brief This file contains the CButton class declaration.
 * \author Vladimir Klubkov (aka marked)
 *
 * Last changes date:
 * \date 15.03.2011
 *
 * Copyright 2011 Vladimir Klubkov <marked-one@yandex.ru>
 *
 * This file is part of OOXlib.
 *
 * OOXLib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * OOXlib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OOXlib; if not, you can try to find  it here:
 * http://www.gnu.org/licenses/gpl.txt
 * or write to the Free Software Foundation, Inc., 59 Temple Place,
 * Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "CSimpleWindow.h"
#include "CGraphicsContext.h"

namespace OOXlib {

/**
 * \class CButton
 * Button class.
 */
// \todo (marked#1#): Create other widgets - checkboxes, lists, radiobuttons etc.
// \todo (marked#1#): Add a possibility to change the button style (maybe button borders must be read from *.xpm files?).
class CButton : public CSimpleWindow {
public:
    /**
     * \class CDeleteWindowException
     * Exception handler class.
     */
    class CDeleteWindowException : public CException {
    public:
        CDeleteWindowException(const ::std::string &File, const int iLine, const ::std::string &Function);
    };
public:
// Constructor.
    CButton(const CXServerConnection *pXServerConnection, const CScreen *pScreen, IWindow *pParentWindow, const CUInt2dRectangle &Rectangle, const IEventHandler *pEventHandler,
            const ::std::string &ButtonText, const CColor *pBackgroundColor, const CColor *pTextColor, const unsigned int iHorizontalOffset, const unsigned int iVerticalOffset);
// Destructor.
    ~CButton();
// Events handlers.
    void OnExpose();
    void OnButtonPress(const unsigned int iButton, const int iX UNUSED_PARAM, const int iY UNUSED_PARAM);
    void OnButtonRelease(const unsigned int iButton,const  int iX UNUSED_PARAM, const int iY UNUSED_PARAM);
    void OnMouseEnter(const int iX UNUSED_PARAM, const int iY UNUSED_PARAM);
    void OnMouseExit(const int iX UNUSED_PARAM, const int iY UNUSED_PARAM);
    void OnClick();
private:
    CGraphicsContext *m_pGC;
    ::std::string m_Text;
    const CColor *m_pTextColor;
    unsigned int m_iHorizontalOffset;
    unsigned int m_iVerticalOffset;
    bool m_bIsButtonPressed;
    bool m_bIsMouseOver;
};

}
#endif // CBUTTON_H_INCLUDED
